home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib3 / v_03_02 / 3n02050a < prev    next >
Encoding:
Text File  |  1995-11-01  |  423 b   |  22 lines

  1. // memory.c example 1
  2. // cl /AL /Lp memory.c
  3. // bind286 memory
  4. // memory
  5.  
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8.  
  9. main()
  10. {
  11.     int i = 0;
  12.     printf("Allocating memory...\n");
  13.     while(1)
  14.        if (malloc((unsigned)65512))  
  15.           printf("Allocated 64K: %d blocks\n",++i);
  16.        else
  17.           break;
  18.     printf("Ran out of available memory\n\n");
  19.     printf("Allocated %dK total.\n",i*64);
  20. }
  21.  
  22.